set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-maybe-uninitialized")

file(GLOB_RECURSE SOURCES *.c)
set(INCLUDES)
list(APPEND INCLUDES "pikascript-api")
list(APPEND INCLUDES "pikascript-core")
list(APPEND INCLUDES "pikascript-lib/PikaStdLib")
list(APPEND INCLUDES "pikascript-lib/PikaStdDevice")
list(APPEND INCLUDES "pikascript-lib/ESP32")
list(APPEND INCLUDES "pikascript-lib/pika_libc")
list(APPEND INCLUDES "pikascript-lib/struct")
list(APPEND INCLUDES "../../main")
list(APPEND INCLUDES "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")

if (CONFIG_USING_AHT20)
list(APPEND INCLUDES "pikascript-lib/aht20")
endif()

if (CONFIG_USING_FLASHDB)
list(APPEND INCLUDES "pikascript-lib/flashdb")
endif()

if (CONFIG_USING_M5STACK)
list(APPEND INCLUDES "pikascript-lib/m5stack")
endif()

if (CONFIG_USING_MISC_UTIL)
list(APPEND INCLUDES "pikascript-lib/misc_util")
endif()

if (CONFIG_USING_TIME_SYNC)
list(APPEND INCLUDES "pikascript-lib/time_sync")
endif()

idf_component_register(
                SRCS ${SOURCES}
                INCLUDE_DIRS ${INCLUDES}
		WHOLE_ARCHIVE
		REQUIRES
                driver
                fatfs
                esp_wifi
                nvs_flash
                app_update
                esp_http_client
                esp_https_ota
		lvgl__lvgl
                )
